--鼓励艺术
local guliyishu = fk.CreateSkill{
    name = "mcdh_guliyishu"
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

guliyishu:addEffect(fk.DamageCaused,{
    can_trigger = function(self, event, target, player, data)
        local room = player.room
        return player:hasSkill(self) and player:getMark("mcdh_charge") > 0 and target == room.current
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local cids = room:askForDiscard(
                player,
                1, 1,
                true,
                self.name,
                true,
                ".",
                "#mcdh_guliyishu-choice:" .. data.to.id,
                true
        )
        if #cids > 0 then
            self.cost_data = cids
            return true
        end
        return false
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local card = Fk:getCardById(self.cost_data[1])
        local pattern
        lib.LoseCharge(player, player, 1, self.name)
        room:throwCard(self.cost_data, self.name, player, player)
        if card.color == Card.Black then
            data.damage = data.damage + 1
            pattern = ".|.|heart,diamond"
        elseif card.color == Card.Red then
            data.damage = data.damage - 1
            pattern = ".|.|spade,club"
        end
        local judge = {
            who = player,
            reason = self.name,
            pattern = pattern,
            skipDrop = true,
        }
        room:judge(judge)
        if judge.card.color ~= card.color and room:getCardArea(judge.card) == Card.Processing then
            room:moveCards({
                ids = { judge.card.id },
                from = nil,
                to = player.id,
                toArea = Card.PlayerHand,
                moveReason = fk.ReasonPrey,
                skillName = self.name,
                moveVisible = true
            })
        elseif room:getCardArea(judge.card) == Card.Processing then
            room:moveCards({
                ids = { judge.card.id },
                from = nil,
                to = nil,
                toArea = Card.DiscardPile,
                moveReason = fk.ReasonJudge,
                skillName = self.name,
                moveVisible = true
            })
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_guliyishu"] = "励战",
    [":mcdh_guliyishu"] = "『鼓励艺术』<br>蓄力技(1)，当前回合角色造成伤害时，你可以弃置一张黑色牌，令此伤害值+1；或弃置一张红色牌，令此伤害值-1。若如此做，你进行一次判定，获得与弃置牌颜色不同的判定牌。",
    ["#mcdh_guliyishu-choice"] = "鼓励艺术:弃置一张黑色牌令伤害+1、或弃置一张红色牌令伤害-1",
}

return guliyishu